//# sourceURL=inviteCompanyJobList.js
layui.element.on('tab(login-user-tabs)', function () {
    var currPage = 1;
    var inviteCompanyJobList_fn = {
        initRender: function () {
            layui.table.render({
                id: 'inviteCompanyJobListTableId',
                elem: '#inviteCompanyJobList-table',
                url: '/inviteCompanyJob/list',
                height: 'full-170',
                page: true,
                limits: cmsUtils.getLimits(),
                limit: cmsUtils.getLimit(),
                cols:[[
                    {title: '<b>序号</b>',type: 'numbers',align: 'center',width: 80},
                    {title: '<b>职位</b>',field: 'jobTitleValue'},
                    {title: '<b>薪资</b>',field: 'salary'},
                    {title: '<b>学历要求</b>',field: 'eduRequireValue',width: 180},
                    {title: '<b>年龄要求</b>',field: 'workAgeRequire',width: 180},
                    {title: '<b>状态</b>',field: 'statusName'},
                    {title: '<b>创建时间</b>',field: 'createDate',align: 'center',width: 160},
                    {title: '<b>操作选项</b>',width: 160,align: 'center',toolbar: '#inviteCompanyJobList-toolbar'}
                ]],
                done: function (res, curr, count) {
                    currPage = curr;
                    $('#inviteCompanyJobList').attr('hasRender', true);
                }
            });
        },
        reload: function (page) {
            layui.table.reload('inviteCompanyJobListTableId', {
                page:{
                    curr: page ? page : currPage
                },
                where:{
                    name: $("#inviteCompanyJobList-input-name").val()
                }
            });
        },
        refreshList: function () {
            if ($('#inviteCompanyJobList')[0]) {
                inviteCompanyJobList_fn.reload(currPage);
            }
        },

        resetSearch: function () {
            $("#inviteCompanyJobList-input-name").val('');
            inviteCompanyJobList_fn.reload(1);
        }
    }
    if (!$('#inviteCompanyJobList').attr('hasRender')) {
        inviteCompanyJobList_fn.initRender();
        // 监听当前Tab页点击
        $(this).bind('tabClick', function () {
            inviteCompanyJobList_fn.refreshList();
        });
        // 搜索
        $('#inviteCompanyJobList-search-btn').click(function () {
            inviteCompanyJobList_fn.reload(1);
        });
        // 重置
        $('#inviteCompanyJobList-refresh-btn').click(function () {
            inviteCompanyJobList_fn.resetSearch();
        });
        // 新增
        $('#inviteCompanyJobList-add-btn').click(function () {
            cmsUtils.addContentTab('inviteCompanyJobDetail', '岗位管理-添加', '/piger/company/inviteCompanyJobDetail.html', {
                list_fn: inviteCompanyJobList_fn
            });
        });
    }
    // 工具条监听
    layui.table.on('tool(inviteCompanyJobList-table)', function (obj) {
        switch (obj.event) {
            case 'edit':
                cmsUtils.addContentTab('inviteCompanyJobDetail', '岗位管理-编辑', '/piger/company/inviteCompanyJobDetail.html', {
                    id: obj.data.id,
                    list_fn: inviteCompanyJobList_fn
                });
                break;
            default:
                break;
        }
    });
});